import { createStore } from 'vuex'

const store = createStore({
  state: {
    userInfo: {},
    accessToken: localStorage.getItem('accessToken') ? localStorage.getItem('accessToken') : ''
  },
  getters: {
  },
  mutations: {
    changeUserInfo(state, userInfo) {
      state.userInfo = userInfo
      localStorage.setItem("userInfo", userInfo)
    },
    changeToken(state, token) {
      state.accessToken = token
      localStorage.setItem("accessToken", token)
    }
  },
  actions: {
  },
  modules: {
  }
})

export default store